From: Dan Williams Date: Tue, 21 Jun 2016 17:48:44 +0000 (-0500) Subject: network: request periodic scans while the WiFi list is open X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~688 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=384e01b3684e14a2de8bdfa1c682b0737ee6540f;p=gnome-shell.git network: request periodic scans while the WiFi list is open NM upstream would like to reduce periodic scanning, and that means that clients should request scans themselves while their WiFi list is open. Similar to the Windows and macOS WiFi dialogs/lists. https://bugzilla.gnome.org/show_bug.cgi?id=767918 --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index fee703bed..9f4293ab7 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -5,6 +5,7 @@ const GObject = imports.gi.GObject; const Gio = imports.gi.Gio; const Gtk = imports.gi.Gtk; const Lang = imports.lang; +const Mainloop = imports.mainloop; const NetworkManager = imports.gi.NetworkManager; const NMClient = imports.gi.NMClient; const NMGtk = imports.gi.NMGtk; @@ -752,10 +753,9 @@ const NMWirelessDialog = new Lang.Class({ this._updateSensitivity(); this._syncView(); - if (accessPoints.length == 0) { - /* If there are no visible access points, request a scan */ - this._device.request_scan_simple(null); - } + this._scanTimeoutId = Mainloop.timeout_add_seconds(15, Lang.bind(this, this._onScanTimeout)); + GLib.Source.set_name_by_id(this._scanTimeoutId, '[gnome-shell] this._onScanTimeout'); + this._onScanTimeout(); }, destroy: function() { @@ -780,9 +780,19 @@ const NMWirelessDialog = new Lang.Class({ this._airplaneModeChangedId = 0; } + if (this._scanTimeoutId) { + Mainloop.source_remove(this._scanTimeoutId); + this._scanTimeoutId = 0; + } + this.parent(); }, + _onScanTimeout: function() { + this._device.request_scan_simple(null); + return GLib.SOURCE_CONTINUE; + }, + _activeApChanged: function() { if (this._activeNetwork) this._activeNetwork.item.setActive(false);